import nltk
from nltk.tag.simplify import simplify_wsj_tag

fr = open('../data/clean-data/positives.txt', 'r')
fw = open('../data/tagged-data/positives.txt', 'w')

for line in fr.readlines():
    line = line.rstrip('\n')
    line = line.rstrip('.')
    line = nltk.word_tokenize(line)
    line = nltk.pos_tag(line)
    line = [(word, simplify_wsj_tag(tag)) for word, tag in line]
    line = ' '.join([nltk.tag.tuple2str(w) for w in line])
    fw.write(line + '.' + '\n')

fr.close()
fw.close()

fr = open('../data/clean-data/negatives.txt', 'r')
fw = open('../data/tagged-data/negatives.txt', 'w')

for line in fr.readlines():
    line = line.rstrip('\n')
    line = line.rstrip('.')
    line = nltk.word_tokenize(line)
    line = nltk.pos_tag(line)
    line = [(word, simplify_wsj_tag(tag)) for word, tag in line]
    line = ' '.join([nltk.tag.tuple2str(w) for w in line])
    fw.write(line + '.' + '\n')

fr.close()
fw.close()
    
    
